<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>管线查询</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<%@ include file="../jslib/jquerylib.jsp" %>
	<link rel="stylesheet" type="text/css" href="<%=path %>/web/style/layout.css" />
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/lhgdialog/lhgcore.lhgdialog.min.js?skin=mac"></script>
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/demo.css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>	
	<script type="text/javascript" src="<%=request.getContextPath()%>/jslib/My97DatePicker/WdatePicker.js"  defer="defer" ></script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	

  </head>
  
  <body>
<!-- 关键字查询 -->  
  	  <div style='float:left;text-align:center;'>
  		<h2>关键字查询</h2><br/>
		<table>
	     	<tr>
	     		<td>字段名称</td>
	     		<td><select class="easyui-combobox"  name="keysearch" 
	     		id="keysearch"  data-options="valueField:'id',textField:'text',
	     		multiple:false,panelHeight:'auto'" 
	     		url='<%=request.getContextPath()%>/searchAction!getFieldname1s.action'  
	     		style="width:250px;height: 26px;">
			    </select>
			   	</td>
	     	</tr>
	     	<tr>
	     		<td>关键字</td>
	     		<td>
	     			<input type='text' id='keyword1' name='keyword1' style="width:250px;height: 26px;"/>
			   	</td>
	     	</tr>
	     </table>	
  	</div>
<!-- 选择查询 -->
  	<div style='text-align:center;'>
  		<h2>选择查询</h2><br/>
		<table>
	     	<tr>
	     		<td>字段名称</td>
	     		<td><select class="easyui-combobox"  name="sfieldname" 
	     		id="sfieldname"  data-options="valueField:'id',textField:'text',
	     		multiple:false,panelHeight:'auto',onSelect:selecttablechange" 
	     		url='<%=request.getContextPath()%>/searchAction!getTablenames.action'  
	     		style="width:250px;height: 26px;" >
			    </select>
			   	</td>
	     	</tr>
	     	<tr>
	     		<td>字典表</td>
	     		<td>
	     		<input id="sfieldvalue" name="sfieldvalue" class="easyui-combobox"  style="width:250px;height: 26px;"
			name="language"
			data-options="
					url:'combobox_data1.json',
					method:'get',
					valueField:'id',
					textField:'text',
					multiple:true,
					panelHeight:'auto'
			">				    
			   	</td>
	     	</tr>
	     </table>
  	</div>
<!--区间查询  -->  
  	  <div style='float:left;text-align:center;'>
  		<h2>区间查询</h2><br/>
		<table>
	     	<tr>
	     		<td>字段名称</td>
	     		<td colspan="2"><select class="easyui-combobox"  name="rfieldname" 
	     		id="rfieldname"  data-options="valueField:'id',textField:'text',
	     		multiple:false,panelHeight:'auto'" 
	     		url='<%=request.getContextPath()%>/searchAction!getFieldname3s.action'  
	     		style="width:250px;height: 26px;">
			    </select>
			   	</td>
	     	</tr>
	     	<tr>
	     		<td>限制条件1：</td>
	     		<td>
	     			<input type='text' id='rfieldvalue1' name='rfieldvalue1' style="width:150px;height: 26px;"/>
			   	</td>
			   	<td><select class="easyui-combobox"  name="rlimit1" 
	     		id="rlimit1"  data-options="valueField:'id',textField:'text',
	     		multiple:false,panelHeight:'auto'" 
	     		url='<%=request.getContextPath()%>/searchAction!getFieldname4s.action?owner=rlimit1'  
	     		style="width:100px;height: 26px;">
			    </select></td>
	     	</tr>
	     	<tr>
	     		<td>限制条件2：</td>
	     		<td>
	     			<input type='text' id='rfieldvalue2' name='rfieldvalue2' style="width:150px;height: 26px;"/>
			   	</td>
			   	<td><select class="easyui-combobox"  name="rlimit2" 
	     		id="rlimit2"  data-options="valueField:'id',textField:'text',
	     		multiple:false,panelHeight:'auto'" 
	     		url='<%=request.getContextPath()%>/searchAction!getFieldname4s.action?owner=rlimit2'
	     		style="width:100px;height: 26px;">
			    </select></td>
	     	</tr>
	     </table>	
  	</div>
  	<!--日期查询  -->  
  	  <div style='float:left;text-align:center;'>
  		<h2>日期查询</h2><br/>
		<table>
	     	<tr>
	     		<td>字段名称</td>
	     		<td><select class="easyui-combobox"  name="dfieldname" 
	     		id="dfieldname"  data-options="valueField:'id',textField:'text',
	     		multiple:false,panelHeight:'auto'" 
	     		url='<%=request.getContextPath()%>/searchAction!getFieldnameDate.action'  
	     		style="width:250px;height: 26px;">
			    </select>
			   	</td>
	     	</tr>
	     	<tr>
	     		<td>起始日期：</td>	     		
			   	<td>
			   	 <input class="Wdate"  type="text" id="dfieldvalue1"  name="dfieldvalue1" 
  			    onClick="WdatePicker({dateFmt: 'yyyy/MM/dd'})" style="width:250px;height: 26px;"  />
			    </td>
	     	</tr>
	     	<tr>
	     		<td>截至日期：</td>
			   	<td>
			   	<input class="Wdate"  type="text" id="dfieldvalue2"  name="dfieldvalue2" 
  			    onClick="WdatePicker({dateFmt: 'yyyy/MM/dd'})" style="width:250px;height: 26px;"  />
			    </td>
	     	</tr>
	     </table>	
  	</div>
  	<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew">
  		    <tr>
  		    	<td align="center"><input id="btnsearch" type="button" value="查 询" class="form_bt_orange" onclick="searchguanduan()" /></td>
  		    </tr>
  	</table>
	
  <script type='text/javascript'>
  		var api = frameElement.api, W = api.opener;
		function selecttablechange(param){
			
			var tableid = param.id;
			alert(tableid);
			$('#sfieldvalue').combobox({ url:'<%=request.getContextPath()%>/searchAction!getFieldname2s.action?tablename='+tableid, valueField:'id', textField:'text'});
		}
		
		function searchguanduan()
		{
		
			//关键字字段
			var kfieldname=$('#keysearch').combobox('getValue');
			//关键字
			var kfieldvalue=document.getElementById("keyword1").value;
			//选择查询字段
			var sfieldname=$('#sfieldname').combobox('getValue');
			//字典表		
			var sfieldvalue= $('#sfieldvalue').combobox('getValues'); 
			//区间查询
			var rfieldname=$('#rfieldname').combobox('getValue');

			//左区间
			var rfieldvalue1=document.getElementById("rfieldvalue1").value;

			var rlimit1=$('#rlimit1').combobox('getValue');

			//由区间
			var rfieldvalue2=document.getElementById("rfieldvalue2").value;

			var rlimit2=$('#rlimit2').combobox('getValue');

			//日期查询字段
			var dfieldname=$('#dfieldname').combobox('getValue');

			//起始日期
			var dfieldvalue1=document.getElementById("dfieldvalue1").value;

			//截至日期
			var dfieldvalue2=document.getElementById("dfieldvalue2").value;

			
			if((kfieldname!='')||(sfieldname!='')||(rfieldname!='')||(dfieldname!=''))
				{
				W.refreshtreebyguanduansearch(kfieldname,kfieldvalue,sfieldname,sfieldvalue,rfieldname,rfieldvalue1,rlimit1,rfieldvalue2,rlimit2,dfieldname,dfieldvalue1,dfieldvalue2);
					
					api.close();;
				}
				else{
					alert("请输入查询条件！");
				}
		}
	</script>	
  </body>
</html>
